<?php
//-------------------------------------------------------------------------------------------------------
    require_once($config['app_dir'] . '/includes/template.class.php');
    require_once($config['app_dir'] . '/classes/forecasts.deamon.php');
    require_once($config['app_dir'] . '/classes/staff.class.php');
    include_once($config['app_dir'] . '/classes/user.data.php');
    include_once($config['app_dir'] . '/classes/DataLists.class.php');
    //---------------------------------------------------------------------------------------------------

    class objLastForecastServer extends objLastForecastDeamon{
            public $system = false;

        protected function BuildPairs($params=false) {
          global $config;
            if( false===$params ) {
                $listPairsSystems = new objPairsSystems();
                $listPairsSystems->system = $this->system;

                return $this->pairs_systems = $listPairsSystems->GetAssocArr();
            } else {
                $Staff = new objStaff($config['app_id']);
                $UserModel = new objUserModel();

                return $this->pairs_systems = $UserModel->GetTradeSystemArr($Staff->UserID(), $this->system);
            }
       } //BuildPairs

        protected function Prepare() {
            $this->BuildPairs(true);
        } //Prepare

        public function Render() {
            /*
          global $config;
            $this->Prepare();
            //--------------------------------------------------------------------------------------
            foreach($this->pairs_systems as $item) {
                $id = $this->GenerateID($item['TradeID'] . '_' . $item['SystemID']);

                $ForecastItem = new objTemplate('en');
                $ForecastItem->caching = 2;
                $ForecastItem->cache_lifetime = $this->caching_time;

                if( !$ForecastItem->is_cached('_ForecastItem.tpl', $id) ) {
                    $this->RenderItem($item['TradeID'], 'en', $item['SystemID']);
                }//if cache not exist

                $text .= $ForecastItem->Fetch('_ForecastItem.tpl', $id);
            } //foreach
            //--------------------------------------------------------------------------------------
            return $text;
            */
        } //Render

    } //class objLastForecastServer

    //---------------------------------------------------------------------------------------------------
    function showLastForecasts($system=0) {
        $LastForecastServer = new objLastForecastServer();
        $LastForecastServer->system = $system;
        //----------------------------------------------------------------------
        $objResponse = new xajaxResponse();
        $objResponse->addAssign("divPlots","innerHTML", $LastForecastServer->Render());
        //----------------------------------------------------------------------
        return $objResponse;
    } //showLastForecasts

//-------------------------------------------------------------------------------------------------------
?>
